import Vue from 'vue';
// v-preventReClick:    防重复点击
Vue.directive('preventReClick', {
  inserted(el, binding) {
    el.addEventListener('click', () => {
      if (!el.hasAttribute('disabled')) {
        el.setAttribute('disabled', true);
        el.classList.add('is-disabled');
        setTimeout(() => {
          el.removeAttribute('disabled');
          el.classList.remove('is-disabled');
        }, binding.value || 3000);
      }
    });
  }
});
